package cn.codeforfun.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * Created by Administrator on 2017/2/26.
 */
@Controller
public class IndexController {
  @RequestMapping("/")
  public String index(@RequestParam(required = false, defaultValue = "index") String name, Model model) {
    model.addAttribute("name", name);
    return "index";
  }

  @RequestMapping("/home")
  public String home(@RequestParam(required = false, defaultValue = "home") String name, Model model) {
    model.addAttribute("name", name);
    return "home";
  }

  @RequestMapping("/hello")
  public String hello(@RequestParam(required = false, defaultValue = "hello") String name, Model model) {
    model.addAttribute("name", name);
    return "hello";
  }
}
